--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit c08cdb65b6b5f6d8ed75bc01dedde8fbb1e63dfe
Parents : d167d7c
Author : Sudo-Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-01-14T18:03:15-06:00
Add Hypothesis settings to lifecycle tests for improved fuzzing
- Introduced settings to disable deadlines in the test_identity_context_repeated_lifecycle function.
- Combined import statements for Hypothesis to streamline the code.
Changes
Diff
diff --git a/tests/backend/test_lifecycle.py b/tests/backend/test_lifecycle.py
index 1cf589d2..321cedee 100644
--- a/tests/backend/test_lifecycle.py
+++ b/tests/backend/test_lifecycle.py
@@ -7,8 +7,7 @@ from unittest.mock import MagicMock, patch
import pytest
import RNS
-from hypothesis import given
-from hypothesis import strategies as st
+from hypothesis import given, settings, strategies as st
from meshchatx.src.backend.database.provider import DatabaseProvider
from meshchatx.src.backend.identity_context import IdentityContext
@@ -157,6 +156,7 @@ def test_identity_context_memory_leak():
assert leak_ref[0]() is None, "IdentityContext was not garbage collected"
+@settings(deadline=None)
@given(st.integers(min_value=1, max_value=3))
def test_identity_context_repeated_lifecycle(n):
"""Fuzz the lifecycle by repeating setup/teardown multiple times with new instances."""
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────